package com.neuedu.cockpit.controller;

import javax.servlet.http.HttpServletResponse;

import com.neuedu.cockpit.domain.HmControlLog;
import com.neuedu.cockpit.service.IHmControlLogService;
import com.neuedu.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.neuedu.common.annotation.Log;
import com.neuedu.common.core.controller.BaseController;
import com.neuedu.common.core.domain.AjaxResult;
import com.neuedu.common.enums.BusinessType;
import com.neuedu.common.core.page.TableDataInfo;

import java.util.List;

/**
 * 车辆操控日志Controller
 * 
 * @author neuedu
 * @date 2024-04-30
 */
@RestController
@RequestMapping("/cockpit/log")
public class HmControlLogController extends BaseController
{
    @Autowired
    private IHmControlLogService hmControlLogService;

    /**
     * 查询车辆操控日志列表
     */
    @GetMapping("/list")
    public TableDataInfo list(HmControlLog hmControlLog)
    {
        startPage();
        List<HmControlLog> list = hmControlLogService.selectHmControlLogList(hmControlLog);
        return getDataTable(list);
    }

    /**
     * 获取车辆操控日志详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(hmControlLogService.selectHmControlLogById(id));
    }

    /**
     * 新增车辆操控日志
     */
    @Log(title = "车辆操控日志", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody HmControlLog hmControlLog)
    {
        return toAjax(hmControlLogService.insertHmControlLog(hmControlLog));
    }

    /**
     * 修改车辆操控日志
     */
    @Log(title = "车辆操控日志", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody HmControlLog hmControlLog)
    {
        return toAjax(hmControlLogService.updateHmControlLog(hmControlLog));
    }

    /**
     * 删除车辆操控日志
     */
    @Log(title = "车辆操控日志", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(hmControlLogService.deleteHmControlLogByIds(ids));
    }
}
